{include file="public/_meta" title="编辑版本"/}
<article class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-version-add">
		<input type="hidden" value="{$version.id}" name="id"/>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>app类型：</label>
			<div class="formControls col-xs-7 col-sm-8">
				<input type="text" class="input-text" value="{$version.app_type}" placeholder="请输入APP类型：android ios" name="app_type">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>内置版本号：</label>
			<div class="formControls col-xs-7 col-sm-8">
				<input type="text" class="input-text" value="{$version.version}" placeholder="请输入内置版本号" name="version">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>对外版本号：</label>
			<div class="formControls col-xs-7 col-sm-8">
				<input type="text" class="input-text" value="{$version.version_code}" placeholder="请输入对外版本号" name="version_code">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>是否强制更新：</label>
			<div class="formControls col-xs-7 col-sm-8">
				<span class="select-box">
					<select name="is_force" class="select">
						<option {if condition="$version['is_force'] eq '是'"}selected="selected"{/if} value="1">是</option>
						<option {if condition="$version['is_force'] eq '否'"}selected="selected"{/if} value="0">否</option>
					</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>升级内容：</label>
			<div class="formControls col-xs-7 col-sm-8">
				<textarea type="text" class="textarea" placeholder="请输入升级内容" name="upgrade_content">{$version.upgrade_content}</textarea>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>app地址：</label>
			<div class="formControls col-xs-7 col-sm-8">
				<textarea type="text" class="textarea" placeholder="请输入app链接地址" name="app_url">{$version.app_url}</textarea>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary size-M radius" type="submit" value="提交">
				<button onClick="parent.layer.close(parent.layer.getFrameIndex(window.name));" class="btn btn-success size-M radius" type="button">取消</button>

			</div>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
{include file="public/_footer" /}
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->

<script type="text/javascript">
	imgUpload({
		inputId:'file', //input框id
		imgBox:'imgBox' //图片容器id
	});

</script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	$("#form-version-add").validate({
		rules:{
			/*    username:{
				required:true,
				minlength:2,
				maxlength:16
			},
			tel:{
				required:true,
				isMobile:true,
			},
			password:{
				required:true,
				minlength:5,
				maxlength:16,
			},
			repassword:{
				required:true,
				minlength:5,
				maxlength:16,
				equalTo: "#password"
			},
			uploadfile:{
				required:true,
			},*/
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){

			var data = $(form).serializeArray();

			$(form).ajaxSubmit({
				type: 'post',
				url: "{:url('version/edit_version')}",
				dataType: 'json',
				data: data,
				success: function(msg){
					if(msg.status == true){
						layer.msg(msg.message,{icon: 6,time:1000});
						setTimeout(jump,1000);
						function jump(){
							parent.location.reload();
						}
					}else if(msg.status == false){
						layer.msg(msg.message,{icon: 5,time:2000});
					}
				},
				error:function (data) {
                    layer.msg(data,{icon: 5,time:2000});
                }
			});
		}
	});
});


</script> 
<!--/请在上方写此页面业务相关的脚本-->
